/**
 * Created by smp on 2017/6/20.
 */
$(function(){
    var nowYear=new Date().getFullYear();
    $("#year").combobox("setValue",nowYear);

   $("#btn_save").click(function () {
       var name=$("#name").textbox("getValue");
       var year=$("#year").combobox("getValue");
       if(name==null||name==""){
           layer.alert("请输入活动人用户名");
           return;
       }
       if(year==null||year==""){
           layer.alert("请输入年份");
           return;
       }
       $.ajax({
           type:"post",
           url:ROOT_PATH+'/majorHazard/statisticsAnalysis/checkUserName.shtml',
           data:{name:name},
           dataType: "json",
           success: function(result){
               if (result.success) {
                   WindowManager.closeLayer({
                       returnValue:{name:name,year:year}
                   });
               }
               else {
                   layer.msg("用户名不存在", {
                       icon: 2,
                       time: 1000
                   });
               }
           }
       });
   });
});